package function

import "strings"

func DispatchCoin(coins int, users []string) (left int, distribution map[string]int) {
	distribution = make(map[string]int, len(users))

	for _, v := range users {
		if strings.Contains(v, "I") || strings.Contains(v, "i") {
			distribution[v] = 1
			coins -= 1
		} else if strings.Contains(v, "E") || strings.Contains(v, "e") {
			distribution[v] = 2
			coins -= 2
		} else if strings.Contains(v, "O") || strings.Contains(v, "o") {
			distribution[v] = 3
			coins -= 3
		} else if strings.Contains(v, "U") || strings.Contains(v, "u") {
			distribution[v] = 4
			coins -= 4
		} else {
			distribution[v] = 0
		}
	}

	left = coins
	return
}
